import Cookies from "js-cookie";
/**
 * 存储session
 */
export const setStore = (name, content) => {
    if (!name) return;
    if (typeof content !== 'string') {
      content = JSON.stringify(content);
    }
    window.localStorage.setItem(name, content)
}

/**
 * 获取session
 */
export const getStore = name => {
    if (!name) return;
    let v = window.localStorage.getItem(name);
    return v == null ? "" : v;
}

/**
 * 删除session
 */
export const removeStore = name => {
    if (!name) return;
    window.localStorage.removeItem(name);
}
/**
 * 存储Cookie
 */
export const setCookie = (name, content) => {
    if (!name) return;
    if (typeof content !== 'string') {
      content = JSON.stringify(content);
    }
    Cookies.set(name, content);
}

/**
* 获取Cookie
*/
export const getCookie = name => {
    if (!name) return;
    let v = Cookies.get(name);
    return v == null ? "" : v;
}

/**
* 删除Cookie
*/
export const removeCookie = name => {
    if (!name) return;
    Cookies.remove(name);
}